if (dailyAttendance is empty) or (buttonName is empty) then
put "true" into dailyAttendance
put id of background button "Present" into buttonName
end if
enableMenuItem 1021,3,true
enableMenuItem 1027,1,false
end openBackground
on doMenu menuItem
global codeList
lock screen
if menuItem contains "About" then
resetCard
resetBackground
restoreMenuBar
go to card "CSL Attendance" of background "About"
unlock screen with zoom close
else if menuItem is "Home" then
resetCard
resetBackground
restoreMenuBar
go home
else if menuItem contains "Quit" then
resetCard
resetBackground
restoreMenuBar false
go to card "Mac School® Shell"
unlock screen with zoom close
else if menuItem is "Report Manager" OR menuItem is "Report Cards" then
resetCard
resetBackground
restoreMenuBar false
go to background menuItem
unlock screen with zoom open
else if menuItem is "Close" then
resetCard
resetBackground
go to background "CSL Attendance"
else if ((menuItem is "All Students") OR (menuItem is "By Class") OR (menuItem is "By Grade") OR (menuItem is "By Homeroom") OR (menuItem is "By ID's") OR (menuItem is "Single Student")) then
resetCard
go to card menuItem of this background
else if ((menuItem is "Period To Daily Link…") OR (menuItem is "Action Comment…") OR (menuItem is "Upload Term Attendance…") OR (menuItem is "Today's Attendance…") OR (menuItem is "Custom Templates…")) then
push card
go to card menuItem of this background
else if menuItem is "Exception Report…" then
push card
go to card "Students" of this background
else if (menuItem is "Class Directory") OR (menuItem is "Open Directory Window") then
push card
go to background "Class Directory"
else if menuItem is "Calculate Daily From Period…" then
repeat with index = 1 to the number of lines of codeList
put line index of codeList into codeID
if showName of background button id codeID then
get the short name of background button id codeID
put (trunc((codeID - 34) / 8) + 1) into lineNumber
if it is "A" then put "Absent Un" into line lineNumber of bg field "Daily Attendance"
end if
end repeat
end if
unlock screen
end doMenu
on groupOne
global dailyAttendance, buttonName, buttonList, codeList
if dailyAttendance then
if short name of target contains "button" then exit groupOne
if buttonName <> id of target then
set hilite of background button id buttonName to false
set hilite of target to true
put id of target into buttonName
end if
lock screen
repeat with index = 1 to the number of lines of buttonList
put short name of target into line line index of buttonList of field "Daily Attendance"
end repeat
unlock screen
else
get id of target
if it is "11" then put "+" into periodCode
else if it is "12" then put "A" into periodCode
else if it is "15" then put "5037" into periodCode
else if it is "16" then put "E" into periodCode
else if it is "19" then put "0" into periodCode
else if it is "20" then put "F" into periodCode
else if it is "23" then put "L" into periodCode
else if it is "24" then put "D" into periodCode
else exit groupOne
if buttonName <> id of target then
set hilite of background button id buttonName to false
set hilite of target to true
put id of target into buttonName
end if
lock screen
if buttonList is not empty then
put buttonList & return before codeList
end if
if (it is "11") or (it is "12") or (it is "16") or (it is "20") or (it is "23") or (it is "24") then
repeat with index = 1 to the number of lines of buttonList
set name of background button id line index of buttonList to periodCode
set icon of background button id line index of buttonList to 0
set showName of background button id line index of buttonList to true
end repeat
else if (it is "15") or (it is "19") then
repeat with index = 1 to the number of lines of buttonList
set icon of background button id line index of buttonList to periodCode
set showName of background button id line index of buttonList to false
end repeat
end if
unlock screen
end if
end groupOne
on groupTwo shiftKey
global dailyAttendance, buttonList
if not dailyAttendance then
lock screen
repeat with index = 1 to the number of lines of buttonList
set hilite of background button id line index of buttonList to false
end repeat
changeType
put id of target into buttonList
set hilite of target to not hilite of target
unlock screen
else
if (the shiftKey is down) or (shiftKey is down) then
set hilite of target to not hilite of target
put id of target & return before buttonList
else
lock screen
repeat with index = 1 to the number of lines of buttonList
set hilite of background button id line index of buttonList to false
end repeat
set hilite of target to true
put id of target into buttonList
unlock screen
end if
end if
end groupTwo
on groupThree shiftKey
global dailyAttendance, buttonList
if dailyAttendance then
lock screen
repeat with index = 1 to the number of lines of buttonList
set hilite of background button id line index of buttonList to false
end repeat
changeType
put id of target into buttonList
set hilite of target to not hilite of target
unlock screen
else
if (the shiftKey is down) or (shiftKey is down) then
set hilite of target to not hilite of target
put id of target & return before buttonList
else
lock screen
repeat with index = 1 to the number of lines of buttonList
set hilite of background button id line index of buttonList to false
end repeat
put id of target into buttonList
set hilite of target to true
unlock screen
end if
end if
end groupThree
on resetCard
global buttonList, codeList
repeat with index = 1 to 10
put "Present" into line index of field "Daily Attendance"
end repeat
repeat with index = 1 to the number of lines of buttonList
set hilite of background button id line index of buttonList to false
end repeat
put empty into buttonList
repeat with index = 1 to the number of lines of codeList
set icon of background button id line index of codeList to 0
set showName of background button id line index of codeList to false
end repeat
put empty into codeList
end resetCard
on resetBackground
global dailyAttendance, buttonName
if not dailyAttendance then changeType
if buttonName is not id of background button "Present" then
set hilite of background button id buttonName to false
set hilite of background button "Present" to true
put id of background button "Present" into buttonName
end if
end resetBackground
on changeType
global dailyAttendance
lock screen
if dailyAttendance then
repeat with index = 11 to 26
set style of background button index to "transparent"
set showName of background button index to false
end repeat
else
repeat with index = 11 to 26
set style of background button index to "opaque"
set showName of background button index to true
end repeat
end if
put not dailyAttendance into dailyAttendance
unlock screen
end changeType
on moveTextFirst
--exit moveTextFirst
put bg field "Students" of first card of this bg into bg field "Students" of this card
put bg field "ID #'s" of first card of this bg into bg field "ID #'s" of this card
put bg field "Daily Attendance" of first card of this bg into bg field "Daily Attendance" of this card
put bg field "Selection" of first card of this bg into bg field "Selection" of this card
end moveTextFirst
on moveTextLast
exit moveTextLast
put bg field "Students" of this card into bg field "Students" of last card of this bg
put bg field "ID #'s" of this card into bg field "ID #'s" of last card of this bg
put bg field "Daily Attendance" of this card into bg field "Daily Attendance" of last card of this bg
put bg field "Selection" of this card into bg field "Selection" of last card of this bg